//
// Decompiled by Jadx - 419ms
//
package gc;

import a.g;
import a.i;
import android.text.TextUtils;
import androidx.appcompat.app.t;
import de.robv.android.xposed.XC_MethodHook;
import fi.c;
import fi.e;
import fi.w;
import fi.y;
import fn.j;
import gc.ck;
import gj.a;
import gj.b;
import gj.d;
import me.plusne.GreenDao.dao.SoulVoiceCollectDao;
import me.plusne.common.Http.Hook;
import me.plusne.common.Json.JsonHookStatic;
import me.plusne.common.Json.Login.JsonLoginDeviceList;
import r.f;

public final class cl implements w.c, w.b {
    public final String a;
    public final String b;
    public final int c;
    public final Object d;
    public final Object e;

    public cl(ck.c cVar, String str, String str2, int i, XC_MethodHook.MethodHookParam methodHookParam) {
        this.d = cVar;
        this.a = str;
        this.b = str2;
        this.c = i;
        this.e = methodHookParam;
    }

    public cl(b bVar, String str, String str2, JsonLoginDeviceList.DataBean dataBean, int i) {
        this.d = bVar;
        this.a = str;
        this.b = str2;
        this.e = dataBean;
        this.c = i;
    }

    public final void h(String str, String str2, w wVar, boolean z) {
        b bVar = (b) this.d;
        JsonLoginDeviceList.DataBean dataBean = (JsonLoginDeviceList.DataBean) this.e;
        int i = this.c;
        bVar.getClass();
        if (!z) {
            wVar.az();
        }
        if (!TextUtils.isEmpty(str)) {
            d dVar = bVar.d;
            y.e(dVar.b);
            String uuid = dataBean.getUuid();
            t.c().j(((Hook) dq.b.b(Hook.class)).updateDeviceName(this.a, this.b, uuid, str).subscribeWith(new a(bVar, dVar.b, dataBean, str, wVar, i)));
        }
    }

    public final void i(w wVar, c.a aVar, int i, int i2) {
        char c;
        f i3;
        String x;
        ck.c cVar = (ck.c) this.d;
        XC_MethodHook.MethodHookParam methodHookParam = (XC_MethodHook.MethodHookParam) this.e;
        cVar.getClass();
        String title = aVar.getTitle();
        title.getClass();
        int hashCode = title.hashCode();
        if (hashCode != -55192384) {
            if (hashCode != 0x25a61ff8) {
                if (hashCode == 0x3009debf && title.equals("收藏语音")) {
                    c = 2;
                }
                c = 65535;
            } else {
                if (title.equals("下载语音")) {
                    c = 1;
                }
                c = 65535;
            }
        } else {
            if (title.equals("复制语音Url")) {
                c = 0;
            }
            c = 65535;
        }
        String str = this.b;
        if (c != 0) {
            ck ckVar = cVar.b;
            if (c != 1) {
                if (c != 2) {
                    j.w(methodHookParam);
                    return;
                }
                JsonHookStatic jsonHookStatic = fn.y.by;
                if (jsonHookStatic.getDb() != null) {
                    SoulVoiceCollectDao soulVoiceCollectDao = jsonHookStatic.getDb().y;
                    soulVoiceCollectDao.getClass();
                    g gVar = new g(soulVoiceCollectDao);
                    gVar.l(SoulVoiceCollectDao.Properties.Url.f(str), new i[0]);
                    if (gVar.h() > 0) {
                        i3 = f.i();
                        i3.k();
                        x = "已收藏过了";
                    } else {
                        w wVar2 = new w(jsonHookStatic.getActivity());
                        wVar2.bj(e.INPUT);
                        wVar2.k = j.as(ckVar.cq, "signature");
                        wVar2.aj = "输入语音备注";
                        wVar2.bb();
                        wVar2.w = new ca(str, this.c);
                        wVar2.bk();
                        return;
                    }
                } else {
                    return;
                }
            } else {
                String str2 = "Voice_" + z.dm(j.as(ckVar.cq, "authorIdEcpt")) + "_" + this.a.replaceAll("[^\\u4e00-\\u9fa5\\w\\-\\.]", "_").trim() + "_" + (System.currentTimeMillis() / 1000);
                fn.g.c(fn.y.by.getActivity(), str, "Voice_" + str2 + ".m4a");
                return;
            }
        } else {
            j.ai(str);
            i3 = f.i();
            i3.n();
            x = androidx.activity.b.x(str, "\n已复制到剪贴板");
        }
        i3.l(x);
    }
}
